package com.kangtu.demogatewayserver.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @program: demo-weix-pay
 * @description: GatewayConfig
 * @author: 亮子说编程
 * @create: 2021-03-08 15:10
 **/

@Slf4j
@Component
public class GatewayConfig implements GlobalFilter, Ordered {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        String url = exchange.getRequest().getURI().getPath();
        log.info("url="+url);

        return chain.filter(exchange);
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
